﻿using System.Collections.Generic;
using DTTB.SERVICE.Base;

namespace DTTB.MV2.QUANLYNHANSUTIENLUONG.BussinessDelegate.Base
{
    public class BaseServiceDelegate<TDto, TEntity> : IBaseServiceDelegate<TDto> //where TDto : BasedDto<System.Int32>
                                                                                 //where TEntity : new()
    

    {
        //public IBaseService<TDto> BaseService { get; set; }

        private BaseService<TDto, TEntity> BaseService = new BaseService<TDto, TEntity>();

        public IList<TDto> GetAllEntities()
        {
            return this.BaseService.GetAllEntities();
        }

        public IList<TDto> GetAllEntities(string tableName)
        {
            return this.BaseService.GetAllEntities(tableName);
        }

        public bool AddNewEntity(TDto dto, ref int idReturn)
        {
            return this.BaseService.AddNewEntity(dto, ref idReturn);
        } 
        
        public bool AddNewEntity(TDto dto)
        {
            return this.BaseService.AddNewEntity(dto);
        }

        public bool AddNewEntity(TDto dto, string table, ref int idReturn)
        {
            return this.BaseService.AddNewEntity(dto, table, ref idReturn);
        }
        
        public bool AddNewEntity(TDto dto, string table)
        {
            return this.BaseService.AddNewEntity(dto, table);
        }
    }
}